home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2005 March
/
PCWorld_2005-03_cd.bin
/
software
/
topware
/
sandra
/
san2005-1037-w64-sso.exe
/
{app}
/
examples
/
mySQL Schema.sql
< prev
next >
Wrap
Text File
|
2004-11-05
|
4KB
|
159 lines
#
# mySQL 3.23+/4.0+ Schema for Sandra Report
#
# Database is assumed to have been created already.
# No size settings included, please add as required.
#
# Copyright (c) 1995-2005, SiSoftware Ltd.
# All Rights Reserved.
#
# Kill all tables
#
DROP TABLE TItem;
DROP TABLE TControl;
DROP TABLE TItemGroup;
DROP TABLE TDevice;
DROP TABLE TClass;
DROP TABLE TModule;
DROP TABLE TReport;
DROP TABLE TIDCount;
#
# Create new tables
#
CREATE TABLE TReport (
ID INT PRIMARY KEY,
ProgVersion INT NOT NULL,
BuildVersion INT NOT NULL,
Completed BIT NOT NULL
);
CREATE TABLE TModule (
ID INT PRIMARY KEY,
ReportID INT NOT NULL,
Capabilities INT NOT NULL,
Col1Percent DOUBLE NOT NULL,
NotRegOK BIT NOT NULL,
Name VARCHAR(255) NOT NULL,
TypeID INT NOT NULL,
HelpID INT NOT NULL,
CONSTRAINT cnstMRID FOREIGN KEY(ReportID) REFERENCES TReport(ID)
);
CREATE TABLE TClass (
ID INT PRIMARY KEY,
ModuleID INT NOT NULL,
Name VARCHAR(255) NOT NULL,
IconID INT NOT NULL,
HelpID INT NOT NULL,
CONSTRAINT cnstCMID FOREIGN KEY(ModuleID) REFERENCES TModule(ID)
);
CREATE TABLE TDevice (
ID INT PRIMARY KEY,
ModuleID INT NOT NULL,
ClassID INT,
Name VARCHAR(255) NOT NULL,
IconID INT NOT NULL,
HelpID INT NOT NULL,
CONSTRAINT cnstDMID FOREIGN KEY(ModuleID) REFERENCES TModule(ID),
CONSTRAINT cnstDCID FOREIGN KEY(ClassID) REFERENCES TClass(ID)
);
CREATE TABLE TItemGroup (
ID INT PRIMARY KEY,
ModuleID INT NOT NULL,
ClassID INT,
DeviceID INT,
Name VARCHAR(255) NOT NULL,
IconID INT NOT NULL,
HelpID INT NOT NULL,
CONSTRAINT cnstGMID FOREIGN KEY(ModuleID) REFERENCES TModule(ID),
CONSTRAINT cnstGCID FOREIGN KEY(ClassID) REFERENCES TClass(ID),
CONSTRAINT cnstGDID FOREIGN KEY(DeviceID) REFERENCES TDevice(ID)
);
CREATE TABLE TItem (
ID INT PRIMARY KEY,
ModuleID INT NOT NULL,
ClassID INT,
DeviceID INT,
GroupID INT,
Name VARCHAR(255) NOT NULL,
DataValue VARCHAR(255),
IconID INT NOT NULL,
TypeID INT NOT NULL,
HelpID INT NOT NULL,
CONSTRAINT cnstIMID FOREIGN KEY(ModuleID) REFERENCES TModule(ID),
CONSTRAINT cnstICID FOREIGN KEY(ClassID) REFERENCES TClass(ID),
CONSTRAINT cnstIDID FOREIGN KEY(DeviceID) REFERENCES TDevice(ID),
CONSTRAINT cnstIGID FOREIGN KEY(GroupID) REFERENCES TItemGroup(ID)
);
CREATE TABLE TControl (
ID INT PRIMARY KEY,
ModuleID INT NOT NULL,
ClassID INT,
DeviceID INT,
Name INT NOT NULL,
DataValID INT NOT NULL,
DataValue VARCHAR(255),
CONSTRAINT cnstTMID FOREIGN KEY(ModuleID) REFERENCES TModule(ID),
CONSTRAINT cnstTCID FOREIGN KEY(ClassID) REFERENCES TClass(ID),
CONSTRAINT cnstTDID FOREIGN KEY(DeviceID) REFERENCES TDevice(ID)
);
CREATE TABLE TIDCount (
TableName VARCHAR(10) PRIMARY KEY,
CurrentID INT NOT NULL
);
#
# Set-up keys/indexes
#
CREATE INDEX ndxModuleName ON TModule (Name);
CREATE INDEX ndxCtrlName ON TControl (Name);
CREATE INDEX ndxGroupName ON TItemGroup (Name);
CREATE INDEX ndxItemName ON TItem (Name);
#
# Inserts
#
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TItem', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TControl', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TItemGroup', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TDevice', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TClass', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TModule', 1);
INSERT INTO TIDCount (TableName, CurrentID) VALUES ('TReport', 1);